#5596 closed enhancement (fixed)

ST_ASGeoJSONRow: cannot set id directly on feature

Reported by: jtojnar Owned by: pramsey
Priority: medium Milestone: PostGIS 3.5.0
Component: postgis Version: 3.4.x
Keywords: json Cc: jtojnar

Description (last modified by jtojnar)

As per GeoJSON RFC, the id should go directly to the feature object rather than to properties:

If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of the Feature object with the name "id"

But ST_ASGeoJSONRow does not support this so one needs to tediously build JSON object manually with jsonb_build_object as described in the manual.

Ideally, there would be a new argument that would allow specifying which column to promote to id.

Change History (3)

comment:1 by jtojnar, 14 months ago

Description: modified (diff)

comment:2 by jtojnar, 14 months ago

Forgot to mention, I have opened a PR with an implemententation: https://github.com/postgis/postgis/pull/749

comment:3 by Regina Obe <lr@…>, 13 months ago

Resolution: fixed
Status: newclosed

In 28853d7/git:

Allow promoting column as an id in ST_AsGeoJsonRow

As per GeoJSON RFC, the id should go directly to the feature object
rather than to properties:

If a Feature has a commonly used identifier, that identifier
SHOULD be included as a member of the Feature object with the name "id"

Let’s add an argument that will allow designating a column as an identifier
so that people do not have to tediously build the JSON object manually.

Closes #5596 for PostGIS 3.5.0
Closes GH-749
Closes https://git.osgeo.org/gitea/postgis/postgis/pulls/165

Note: See TracTickets for help on using tickets.